package cn.snowheart.observer.weather.custom.display;

import cn.snowheart.observer.weather.custom.observer.Observer;
import cn.snowheart.observer.weather.custom.observer.Subject;

/**
 * @author liuwanxiang
 * @version 2019/06/24
 */
public class CurrentConditionsDisplay implements Observer, DisplayElement {

    private int data;
    private Subject subject;

    public CurrentConditionsDisplay(Subject subject) {
        this.subject = subject;
        subject.registerObserver(this);
    }

    @Override
    public void display() {
        System.out.println("show current data..." + data);
    }

    @Override
    public void update(int data) {
        this.data = data;
        display();
    }
}
